home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / gfx / xfig_doc.lha / doc / FORMAT3.1 < prev    next >
Text File  |  1995-08-22  |  17KB  |  522 lines

  1. /*
  2.  * FIG : Facility for Interactive Generation of figures
  3.  * Copyright (c) 1985 by Supoj Sutanthavibul
  4.  * Parts Copyright (c) 1994 by Brian V. Smith
  5.  * Parts Copyright (c) 1991 by Paul King
  6.  *
  7.  * The X Consortium, and any party obtaining a copy of these files from
  8.  * the X Consortium, directly or indirectly, is granted, free of charge, a
  9.  * full and unrestricted irrevocable, world-wide, paid up, royalty-free,
  10.  * nonexclusive right and license to deal in this software and
  11.  * documentation files (the "Software"), including without limitation the
  12.  * rights to use, copy, modify, merge, publish, distribute, sublicense,
  13.  * and/or sell copies of the Software, and to permit persons who receive
  14.  * copies from any such party to do so, with the only requirement being
  15.  * that this copyright notice remain intact.  This license includes without
  16.  * limitation a license to do the foregoing actions under any patents of
  17.  * the party supplying this software to the X Consortium.
  18.  */
  19.  
  20. The only difference from version 3.0 to version 3.1 is that the position
  21. of the "magnet" has been shifted by 14 Fig units.
  22. In the 2.1 and older versions of xfig the grid was in multiples of 5 Fig
  23. units, but they were on intervals 4, 9, 14, 19, etc.
  24. When version 3.0 was created, coordinates were simply multiplied by the
  25. ratio of the resolutions (1200/80 = 15) so values like 4 became 60 instead
  26. of 74 ((4+1)*15 - 1).
  27.  
  28. This means that figures converted from 2.1 and older files are offset by
  29. 14 Fig units but new objects entered with version 3.0 are correct.
  30.  
  31. In version 3.1 the magnet grid is at intervals 0, 75, 150, etc instead of 
  32. -1, 74, 149, etc.
  33. Figures from 2.1 and older are correctly converted now and a warning is popped
  34. up when you read in a version 3.0 file that says you may have to offset the
  35. figure when you load it, using the x and y offsets in the file panel.
  36.  
  37. --------------------------------------------------------------------------------
  38. Description of the Fig Format Follows
  39. --------------------------------------------------------------------------------
  40.  
  41. (1) The very first line is a comment line containing the name and version:
  42.     #FIG 3.1
  43.  
  44.     The character # at the first column of a line indicates that the line
  45.     is a comment line which will be ignored.
  46.  
  47. (2) The first non-comment line consists of two numbers and two strings:
  48.  
  49.     int    fig_resolution        (Fig units/inch)
  50.     string    orientation        ("Landscape" or "Portrait")
  51.     string    justification        ("Center" or "Flush Left")
  52.     string    units            ("Metric" or "Inches")
  53.     int    coordinate_system    (1: origin is the lower left corner (NOT USED)
  54.                      2: upper left)
  55.  
  56.     Fig_resolution is the resolution of the figure in the file.
  57.     Xfig will always write the file with a resolution of 1200ppi so it
  58.     will scale the figure upon reading it in if its resolution is different
  59.     from 1200ppi.  Pixels are assumed to be square.
  60.  
  61.     Xfig will read the orientation string and change the canvas to match
  62.     either the Landscape or Portrait mode of the figure file.
  63.  
  64.     The units specification is self-explanatory.
  65.  
  66.     The coordinate_system variable is ignored - the origin is ALWAYS the
  67.     upper-left corner.
  68.  
  69.     ** Coordinates are given in "fig_resolution" units.
  70.     ** Line thicknesses are given in 1/80 of an inch ("display units").  The
  71.        minimum line thickness is 0 (no line is drawn) and the maximum is 500.
  72.     ** dash-lengths/dot-gaps are given in 1/80 of an inch.
  73.  
  74.  
  75. (3) The rest of the file contains various objects.  An object can be one
  76.     of six classes (or types).
  77.  
  78.     0)    Color pseudo-object.
  79.     1)    Arc.
  80.     2)    Ellipse which is a generalization of circle.
  81.     3)    Polyline which includes polygon and box.
  82.     4)    Spline which includes closed/open control/interpolated spline.
  83.     5)    Text.
  84.     6)    Compound object which is composed of one or more objects.
  85.  
  86.     In the following elaboration on object formats, every value of Fig
  87.     output are separated by blank characters or new line ('\n').  The
  88.     value of the unused parameters will be -1.
  89.  
  90.     Some fields are described as "enumeration type" or "bit vector"; the
  91.     values which these fields can take are defined in the header file object.h.
  92.     The pen_style field is unused.
  93.     These values may be defined in some future version of Fig.
  94.  
  95.     The two color fields (pen and fill; pen only, for texts) are
  96.     defined as follows:
  97.  
  98.         -1 = Default
  99.          0 = Black
  100.          1 = Blue
  101.          2 = Green
  102.          3 = Cyan
  103.          4 = Red
  104.          5 = Magenta
  105.          6 = Yellow
  106.          7 = White
  107.       8-11 = four shades of blue (dark to lighter)
  108.      12-14 = three shades of green (dark to lighter)
  109.      15-17 = three shades of cyan (dark to lighter)
  110.      18-20 = three shades of red (dark to lighter)
  111.      21-23 = three shades of magenta (dark to lighter)
  112.      24-26 = three shades of brown (dark to lighter)
  113.      27-30 = four shades of pink (dark to lighter)
  114.         31 = Gold
  115.  
  116.      values from 32 to 543 (512 total) are user colors and
  117.      are defined in color pseudo-objects (type 0)
  118.  
  119.     For WHITE color, the area fill field is defined as follows:
  120.     
  121.     -1 = not filled
  122.      0 = black
  123.     ...  values from 1 to 19 are shades of grey, from darker to lighter
  124.     20 = white
  125.     21-40 not used
  126.     41-56 see patterns for colors, below
  127.  
  128.     For BLACK or DEFAULT color, the area fill field is defined as follows:
  129.     
  130.     -1 = not filled
  131.      0 = white
  132.     ...  values from 1 to 19 are shades of grey, from lighter to darker
  133.     20 = black
  134.     21-40 not used
  135.     41-56 see patterns for colors, below
  136.  
  137.     For all other colors, the area fill field is defined as follows:
  138.  
  139.     -1 = not filled
  140.      0 = black
  141.     ...  values from 1 to 19 are "shades" of the color, from darker to lighter.
  142.         A shade is defined as the color mixed with black
  143.     20 = full saturation of the color
  144.     ...  values from 21 to 39 are "tints" of the color from the color to white.
  145.         A tint is defined as the color mixed with white
  146.     40 = white
  147.     41 = 30 degree left diagonal pattern
  148.     42 = 30 degree right diagonal pattern
  149.     43 = 30 degree crosshatch
  150.     44 = 45 degree left diagonal pattern
  151.     45 = 45 degree right diagonal pattern
  152.     46 = 45 degree crosshatch
  153.     47 = bricks
  154.     48 = circles
  155.     49 = horizontal lines
  156.     50 = vertical lines
  157.     51 = crosshatch
  158.     52 = fish scales
  159.     53 = small fish scales
  160.     54 = octagons
  161.     55 = horizontal "tire treads"
  162.     56 = vertical "tire treads"
  163.  
  164.     The depth field is defined as follows:
  165.  
  166.      0 ... 999 where larger value means object is deeper than (under)
  167.            objects with smaller depth
  168.  
  169.     The line_style field is defined as follows:
  170.  
  171.     -1 = Default
  172.      0 = Solid
  173.      1 = Dashed
  174.      2 = Dotted
  175.  
  176.     The style_val field is defined as the length, in 1/80 inches, of the on/off
  177.     dashes for dashed lines, and the distance between the dots, in 1/80 inches,
  178.     for dotted lines.
  179.  
  180.     The join_style field is defined FOR LINES only as follows:
  181.  
  182.      0 = Miter (the default in xfig 2.1 and earlier)
  183.      1 = Bevel
  184.      2 = Round
  185.  
  186.     The cap_style field is defined FOR LINES, OPEN SPLINES and ARCS only as follows:
  187.  
  188.      0 = Butt (the default in xfig 2.1 and earlier)
  189.      1 = Round
  190.      2 = Projecting
  191.  
  192.     The arrow_type field is defined for LINES, ARCS and OPEN SPLINES
  193.     only as follows:
  194.  
  195.      0 = Stick-type (the default in xfig 2.1 and earlier)
  196.      1 = Closed triangle:
  197.         |\
  198.         |  \
  199.         |    \
  200.         |    /
  201.         |  /
  202.         |/
  203.      2 = Closed with "indented" butt:
  204.         |\
  205.         \  \
  206.          \   \
  207.           \    \
  208.           /    /
  209.          /   /
  210.         /  /
  211.         |/
  212.      3 = Closed with "pointed" butt:
  213.            |\
  214.           /   \
  215.          /      \
  216.         /         \
  217.         \         /
  218.          \      /
  219.           \   /
  220.            |/
  221.  
  222.     The arrow_style field is defined for LINES, ARCS and OPEN SPLINES
  223.     only as follows:
  224.  
  225.      0 = Hollow (actually filled with white)
  226.      1 = Filled with pen_color
  227.  
  228. (3.0) OBJECT DEFINITION:
  229.  
  230.     (3.1) Color Pseudo-objects (user-defined colors)
  231.       This is used to define arbitrary colors beyond the 32 standard colors.
  232.       The color objects must be defined before any other Fig objects.
  233.  
  234.     First line:
  235.     type    name            (brief description)
  236.     ----    ----            -------------------
  237.     int    object_code        (always 0)
  238.     int    color_number        (color number, from 32-543 (512 total))
  239.      hex string    rgb values        (hexadecimal string describing red,
  240.                      green and blue values (e.g. #330099) )
  241.  
  242.     (3.2) ARC
  243.  
  244.     First line:
  245.     type    name            (brief description)
  246.     ----    ----            -------------------
  247.     int    object_code        (always 5)
  248.     int    sub_type        (0: pie-wedge (closed)
  249.                      1: open ended arc)
  250.     int    line_style        (enumeration type)
  251.     int    line_thickness        (1/80 inch)
  252.     int    pen_color        (enumeration type, pen color)
  253.     int    fill_color        (enumeration type, fill color)
  254.     int    depth            (enumeration type)
  255.     int    pen_style        (pen style, not used)
  256.     int    area_fill        (enumeration type, -1 = no fill)
  257.     float    style_val        (1/80 inch)
  258.     int    cap_style        (enumeration type)
  259.     int    direction        (0: clockwise, 1: counterclockwise)
  260.     int    forward_arrow        (0: no forward arrow, 1: on)
  261.     int    backward_arrow        (0: no forward arrow, 1: on)
  262.     float    center_x, center_y    (center of the arc)
  263.     int    x1, y1            (Fig units, the 1st point the user entered)
  264.     int    x2, y2            (Fig units, the 2nd point)
  265.     int    x3, y3            (Fig units, the last point)
  266.  
  267.     Forward arrow line (Optional; absent if forward_arrow is 0):
  268.     type    name            (brief description)
  269.     ----    ----            -------------------
  270.     int    arrow_type        (enumeration type)
  271.     int    arrow_style        (enumeration type)
  272.     float    arrow_thickness        (1/80 inch)
  273.     float     arrow_width        (Fig units)
  274.     float    arrow_height        (Fig units)
  275.  
  276.     Backward arrow line (Optional; absent if backward_arrow is 0):
  277.     type    name            (brief description)
  278.     ----    ----            -------------------
  279.     int    arrow_type        (enumeration type)
  280.     int    arrow_style        (enumeration type)
  281.     float    arrow_thickness        (1/80 inch)
  282.     float    arrow_width        (Fig units)
  283.     float    arrow_height        (Fig units)
  284.  
  285.     (3.3) COMPOUND
  286.  
  287.     A line with object code 6 signifies the start of a compound.
  288.     There are four more numbers on this line which indicate the
  289.     upper right corner and the lower left corner of the bounding
  290.     box of this compound.  A line with object code -6 signifies
  291.     the end of the compound.  Compound may be nested.
  292.  
  293.     First line:
  294.     type    name            (brief description)
  295.     ----    ----            -------------------
  296.     int    object_code        (always 6)
  297.     int    upperright_corner_x    (Fig units)
  298.     int    upperright_corner_y    (Fig units)
  299.     int    lowerleft_corner_x    (Fig units)
  300.     int    lowerleft_corner_y    (Fig units)
  301.  
  302.     Subsequent lines:
  303.     objects
  304.     .
  305.     .
  306.  
  307.     Last line:
  308.     -6
  309.  
  310.     (3.4) ELLIPSE
  311.  
  312.     First line:
  313.     type    name            (brief description)
  314.     ----    ----            -------------------
  315.     int    object_code        (always 1)
  316.     int    sub_type        (1: ellipse defined by radiuses
  317.                      2: ellipse defined by diameters
  318.                      3: circle defined by radius
  319.                      4: circle defined by diameter)
  320.     int    line_style        (enumeration type)
  321.     int    thickness        (1/80 inch)
  322.     int    pen_color        (enumeration type, pen color)
  323.     int    fill_color        (enumeration type, fill color)
  324.     int    depth            (enumeration type)
  325.     int    pen_style        (pen style, not used)
  326.     int    area_fill        (enumeration type, -1 = no fill)
  327.     float    style_val        (1/80 inch)
  328.     int    direction        (always 1)
  329.     float    angle            (radians, the angle of the x-axis)
  330.     int    center_x, center_y    (Fig units)
  331.     int    radius_x, radius_y    (Fig units)
  332.     int    start_x, start_y    (Fig units; the 1st point entered)
  333.     int    end_x, end_y        (Fig units; the last point entered)
  334.  
  335.     (3.5) POLYLINE
  336.  
  337.     First line:
  338.     type    name            (brief description)
  339.     ----    ----            -------------------
  340.     int    object_code        (always 2)
  341.     int    sub_type        (1: polyline
  342.                      2: box
  343.                      3: polygon
  344.                      4: arc-box)
  345.                      5: imported-picture bounding-box)
  346.     int    line_style        (enumeration type)
  347.     int    thickness        (1/80 inch)
  348.     int    pen_color        (enumeration type, pen color)
  349.     int    fill_color        (enumeration type, fill color)
  350.     int    depth            (enumeration type)
  351.     int    pen_style        (pen style, not used)
  352.     int    area_fill        (enumeration type, -1 = no fill)
  353.     float    style_val        (1/80 inch)
  354.     int    join_style        (enumeration type)
  355.     int    cap_style        (enumeration type, only used for POLYLINE)
  356.     int    radius            (1/80 inch, radius of arc-boxes)
  357.     int    forward_arrow        (0: off, 1: on)
  358.     int    backward_arrow        (0: off, 1: on)
  359.     int    npoints            (number of points in line)
  360.  
  361.     Forward arrow line: same as ARC object
  362.  
  363.     Backward arrow line: same as ARC object
  364.  
  365.     Points line:
  366.     type    name            (brief description)
  367.     ----    ----            -------------------
  368.     int    x1, y1            (Fig units)
  369.     int    x2, y2            (Fig units)
  370.       .
  371.       .
  372.     int    xnpoints ynpoints    (this will be the same as the 1st
  373.                     point for polygon and box)
  374.  
  375.     PIC line:
  376.     type    name            (brief description)
  377.     ----    ----            -------------------
  378.     boolean    flipped            orientation = normal (0) or flipped (1)
  379.     char    file[]            name of picture file to import
  380.  
  381.     (3.6) SPLINE
  382.  
  383.     First line:
  384.     type    name            (brief description)
  385.     ----    ----            -------------------
  386.     int    object_code        (always 3)
  387.     int    sub_type        (0: open spline
  388.                      1: closed spline
  389.                      2: open interpolated spline
  390.                      3: closed interpolated spline)
  391.     int    line_style        (See the end of this section)
  392.     int    thickness        (1/80 inch)
  393.     int    pen_color        (enumeration type, pen color)
  394.     int    fill_color        (enumeration type, fill color)
  395.     int    depth            (enumeration type)
  396.     int    pen_style        (pen style, not used)
  397.     int    area_fill        (enumeration type, -1 = no fill)
  398.     float    style_val        (1/80 inch)
  399.     int    cap_style        (enumeration type, only used for open splines)
  400.     int    forward_arrow        (0: off, 1: on)
  401.     int    backward_arrow        (0: off, 1: on)
  402.     int    npoints            (number of control points in spline)
  403.  
  404.     Forward arrow line: same as ARC object
  405.  
  406.     Backward arrow line: same as ARC object
  407.  
  408.     Points line: same as POLYLINE object
  409.  
  410.     Control points line (absent if sub_type is 0 or 1):
  411.     Control points of interpolated spline.  There are two control
  412.     points for each knots.  A section i, of the spline is drawn
  413.     using Bezier cubic with the following four points:
  414.         (x ,y ), (rx ,ry ), (lx      , ly   ), (x   , y   ).
  415.           i  i        i    i      i+1    i+1     i+1   i+1
  416.     For closed interpolated spline the last pair of control points,
  417.     (lxnpoints,lynpoints) and (rxnpoints,rynpoints) (which can be ignored),
  418.     are the same as (lx1,ly1) and (rx1,ry1) respectively.
  419.  
  420.     type    name            (brief description)
  421.     ----    ----            -------------------
  422.     float    lx1, ly1        (Fig units)
  423.     float    rx1, ry1        (Fig units)
  424.     float    lx2, ly2        (Fig units)
  425.     float    rx2, ry2        (Fig units)
  426.       .
  427.       .
  428.     float    lxnpoints, lynpoints    (Fig units)
  429.     float    rxnpoints, rynpoints    (Fig units)
  430.  
  431.     (3.7) TEXT
  432.     type    name            (brief description)
  433.     ----    ----            -------------------
  434.     int    object             (always 4)
  435.     int    sub_type        (0: Left justified
  436.                      1: Center justified
  437.                      2: Right justified)
  438.     int    color            (enumeration type)
  439.     int    depth            (enumeration type)
  440.     int    pen_style        (enumeration , not used)
  441.     int    font             (enumeration type)
  442.     float    font_size         (font size in points)
  443.     float    angle            (radians, the angle of the text)
  444.     int    font_flags        (bit vector)
  445.     float    height            (Fig units)
  446.     float    length            (Fig units)
  447.     int    x, y            (Fig units, coordinate of the origin
  448.                      of the string.  If sub_type = 0, it is
  449.                      the lower left corner of the string.
  450.                      If sub_type = 1, it is the lower
  451.                      center.  Otherwise it is the lower
  452.                      right corner of the string.)
  453.     char    string[]        (ASCII characters; starts after a blank
  454.                      character following the last number and
  455.                      ends before the sequence '\001'.  This
  456.                      sequence is not part of the string.
  457.                      Characters above octal 177 are
  458.                      represented by \xxx where xxx is the
  459.                      octal value.  This permits Fig files to
  460.                      be edited with 7-bit editors and sent
  461.                      by e-mail without data loss.
  462.                      Note that the string may contain '\n'.)
  463.  
  464.     The font_flags field is defined as follows:
  465.  
  466.      Bit    Description
  467.  
  468.       0    Rigid text (text doesn't scale when scaling compound objects)
  469.       1    Special text (for LaTeX)
  470.       2    PostScript font (otherwise LaTeX font is used)
  471.       3    Hidden text
  472.  
  473.     The font field is defined as follows:
  474.  
  475.     For font_flags bit 2 = 0 (LaTeX fonts):
  476.  
  477.      0    Default font
  478.      1    Roman
  479.      2    Bold
  480.      3    Italic
  481.      4    Sans Serif
  482.      5    Typewriter
  483.  
  484.     For font_flags bit 3 = 1 (PostScript fonts):
  485.  
  486.     -1    Default font
  487.      0    Times Roman
  488.      1    Times Italic
  489.      2    Times Bold
  490.      3    Times Bold Italic
  491.      4    AvantGarde Book
  492.      5    AvantGarde Book Oblique
  493.      6    AvantGarde Demi
  494.      7    AvantGarde Demi Oblique
  495.      8    Bookman Light
  496.      9    Bookman Light Italic
  497.     10    Bookman Demi
  498.     11    Bookman Demi Italic
  499.     12    Courier
  500.     13    Courier Oblique
  501.     14    Courier Bold
  502.     15    Courier Bold Oblique
  503.     16    Helvetica
  504.     17    Helvetica Oblique
  505.     18    Helvetica Bold
  506.     19    Helvetica Bold Oblique
  507.     20    Helvetica Narrow
  508.     21    Helvetica Narrow Oblique
  509.     22    Helvetica Narrow Bold
  510.     23    Helvetica Narrow Bold Oblique
  511.     24    New Century Schoolbook Roman
  512.     25    New Century Schoolbook Italic
  513.     26    New Century Schoolbook Bold
  514.     27    New Century Schoolbook Bold Italic
  515.     28    Palatino Roman
  516.     29    Palatino Italic
  517.     30    Palatino Bold
  518.     31    Palatino Bold Italic
  519.     32    Symbol
  520.     33    Zapf Chancery Medium Italic
  521.     34    Zapf Dingbats
  522.